# 接口

<%_ for(const tag in data){ _%>

## <%= tag%>

-------------------

  #### 1. 模型定义

  <%_ for(const def of data[tag].definitions){ _%>

  * ```<%=def%>```

  |名称|类型|描述|
  |---|---|---|
  <%_ for(const key in definitions[def].properties){
    const prop = definitions[def].properties[key]
  _%>
  |<%=key%>|<%=prop.type%>|<%=prop.description%>|
  <%_}_%>
  <%_}_%>

  <%_
    var i=2;
    for(const api of data[tag].apis){

  _%>

  #### <%=i++%>. <%= api.summary%>

  * 路径

    **`<%=api.method.toUpperCase()%>` `<%=api.path%>`**

  * 请求参数

    |名称|传递方式|必填|描述|示例|
    |---|---|---|---|---|
  <%_ const params = api.parameters || []
      for(const param of params){ _%>
    |<%=param.name%>|<%=param.in%>|<%=param.required?'是':''%>|<%=param.description%>|<%=param.example%>|
  <%_ } _%>

  * 响应结果

    |返回码|返回类型|描述|
    |---|---|---|
  <%_ const resps = api.responses || []
      for(const code in resps){
      const ref = resps[code]?.schema?.$ref?.replace(/#\/definitions\//,'')
      let respType = ref
      if(resps[code].schema?.type === 'array'){
        const itemRef = resps[code].schema?.items?.$ref.replace(/#\/definitions\//,'')
        respType = `List<${itemRef}>`
      }
  _%>
    |<%=code%>|<%=respType%>|<%=resps[code].description%>|
  <%_ } _%>

<%_ } _%>
<%_ } _%>
